home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / wdj0796.zip / RAJA.ZIP / GENERIC.CPP < prev    next >
C/C++ Source or Header  |  1996-03-08  |  4KB  |  141 lines

  1. // generic.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "generic.h"
  6.  
  7. #include "mainfrm.h"
  8. #include "generdoc.h"
  9. #include "genervw.h"
  10.  
  11. #include "splitter.h"        // For splitter frame
  12.  
  13. #ifdef _DEBUG
  14. #undef THIS_FILE
  15. static char BASED_CODE THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CGenericApp
  20.  
  21. BEGIN_MESSAGE_MAP(CGenericApp, CWinApp)
  22.     //{{AFX_MSG_MAP(CGenericApp)
  23.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code!
  26.     //}}AFX_MSG_MAP
  27.     // Standard file based document commands
  28.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  29.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  30. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CGenericApp construction
  34.  
  35. CGenericApp::CGenericApp()
  36. {
  37.     // TODO: add construction code here,
  38.     // Place all significant initialization in InitInstance
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // The one and only CGenericApp object
  43.  
  44. CGenericApp NEAR theApp;
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CGenericApp initialization
  48.  
  49. BOOL CGenericApp::InitInstance()
  50. {
  51.     // Standard initialization
  52.     // If you are not using these features and wish to reduce the size
  53.     //  of your final executable, you should remove from the following
  54.     //  the specific initialization routines you do not need.
  55.  
  56.     SetDialogBkColor();        // Set dialog background color to gray
  57.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  58.  
  59.     // Register the application's document templates.  Document templates
  60.     //  serve as the connection between documents, frame windows and views.
  61.  
  62.     CMultiDocTemplate* pDocTemplate;
  63.     pDocTemplate = new CMultiDocTemplate(
  64.         IDR_GENERITYPE,
  65.         RUNTIME_CLASS(CGenericDoc),
  66.         RUNTIME_CLASS(CSplitterFrame),
  67.         RUNTIME_CLASS(CGenericView));
  68.     AddDocTemplate(pDocTemplate);
  69.  
  70.     // create main MDI Frame window
  71.     CMainFrame* pMainFrame = new CMainFrame;
  72.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  73.         return FALSE;
  74.     m_pMainWnd = pMainFrame;
  75.  
  76.     // create a new (empty) document
  77.     OnFileNew();
  78.  
  79.     if (m_lpCmdLine[0] != '\0')
  80.     {
  81.         // TODO: add command line processing here
  82.     }
  83.  
  84.     // The main window has been initialized, so show and update it.
  85.     pMainFrame->ShowWindow(m_nCmdShow);
  86.     pMainFrame->UpdateWindow();
  87.  
  88.     return TRUE;
  89. }
  90.  
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CAboutDlg dialog used for App About
  93.  
  94. class CAboutDlg : public CDialog
  95. {
  96. public:
  97.     CAboutDlg();
  98.  
  99. // Dialog Data
  100.     //{{AFX_DATA(CAboutDlg)
  101.     enum { IDD = IDD_ABOUTBOX };
  102.     //}}AFX_DATA
  103.  
  104. // Implementation
  105. protected:
  106.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  107.     //{{AFX_MSG(CAboutDlg)
  108.         // No message handlers
  109.     //}}AFX_MSG
  110.     DECLARE_MESSAGE_MAP()
  111. };
  112.  
  113. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  114. {
  115.     //{{AFX_DATA_INIT(CAboutDlg)
  116.     //}}AFX_DATA_INIT
  117. }
  118.  
  119. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  120. {
  121.     CDialog::DoDataExchange(pDX);
  122.     //{{AFX_DATA_MAP(CAboutDlg)
  123.     //}}AFX_DATA_MAP
  124. }
  125.  
  126. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  127.     //{{AFX_MSG_MAP(CAboutDlg)
  128.         // No message handlers
  129.     //}}AFX_MSG_MAP
  130. END_MESSAGE_MAP()
  131.  
  132. // App command to run the dialog
  133. void CGenericApp::OnAppAbout()
  134. {
  135.     CAboutDlg aboutDlg;
  136.     aboutDlg.DoModal();
  137. }
  138.  
  139. /////////////////////////////////////////////////////////////////////////////
  140. // CGenericApp commands
  141.